<!-- <!DOCTYPE html> -->
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<!-- 使用UTF-8 -->
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<!-- 设置移动终端可视区域 -->
		<meta content="telephone=no" name="format-detection">
		<!-- 禁止iPhone等手机自动将数字变成可点击的拨号连接 -->
		<title>966588服务</title>
		<link href="css/style.css" type="text/css" rel="stylesheet" />
		<link href="css/weui.css" type="text/css" rel="stylesheet" />
	</head>
	<body style="background: #F6F6F6;">
		<div class="index" id="containerVue" v-cloak>
			<div class="headerView">
				<i onclick="closeView()">&#139;</i>
				<h1>"966588"查询系统</h1>
				<div></div>
			</div>
			<div class="search">
				<img src="image/logo.png" alt="" class="img">
				<div class="input">
					<img src="image/search.png" alt="" class="icon">
					<form action="javascript:return true;">
						<input @keyup.enter="searchName" type="search" v-model="param.keyWord" placeholder="请输入名称">
					</form>
					<span class="close" v-show="param.keyWord" @click="clearSearch">&#10006;</span>
				</div>
			</div>
			<div style="height: 3.5rem;"></div>
			<div class="cont">
				<div class="list">
					<!-- <div class="title">{{items.contractName}}</div> -->
					<div class="ul">
						<div v-if="info.length!=0">
							<div class="li" v-for="item in info">
								<div class="h1" @click="listDetail(item)"><span class="state state4" v-if="item.realCompletedTime"><img src="image/icons_complete.png" alt="">已完成</span>{{item.name}}</div>
								<div class="liView">
									<!-- <img src="image/login-pic.png" alt="" class="img"> -->
									<div class="h6">
										<div class="h6Cont" v-if="item.busUserName"><img src="image/icons_person.png">{{item.busUserName}}</div>
										<div class="h6Cont" v-if="item.code"><img src="./image/icons_phone.png">{{item.contactPhone}}</div>
									</div>
									<div class="handle clearfix">
										<div class="btn btn4" @click="taskClick(item)" v-if="item.applyStatus == 0">任务调整</div>
										<div class="btn btn1" @click="evalUrl(item)">评价</div>
										<div class="btn btn2" @click="compUrl(item)">投诉</div>
									</div>
								</div>
								<div class="speedView">
									<!-- <div class="h3">当前进度</div> -->
									<div class="speed">
										<div class="sel" :class="[item.projectNode < 0?'':'active']">
											<span class="circle1"><span class="circle2"><span class="circle3">1</span></span></span>
											<div>资料准备和外业生产</div>
										</div>
										<div class="sel" :class="[item.projectNode < 1?'':'active']">
											<i>&#8594;</i>
											<span class="circle1"><span class="circle2"><span class="circle3">2</span></span></span>
											<div>内业生产</div>
										</div>
										<div class="sel" :class="[item.projectNode < 2?'':'active']">
											<i>&#8594;</i>
											<span class="circle1"><span class="circle2"><span class="circle3">3</span></span></span>
											<div>成果质检</div>
										</div>
										<div class="sel" :class="[item.projectNode < 3?'':'active']">
											<i>&#8594;</i>
											<span class="circle1"><span class="circle2"><span class="circle3">4</span></span></span>
											<div>领取报告</div>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="li liText" style="margin-top: 8rem;" v-else><img src="image/kong.png" alt="" class="kong">暂无相关项目</div>
					</div>
				</div>
			</div>
			<div class="js_dialog" style="opacity: 1;" v-if="tipBoole">
				<div class="weui-mask"></div>
				<div class="weui-dialog" style="border-radius: 20px;background-color: transparent;">
					<div class="weui-dialog__hd" style="background-color: rgba(7,135,213,.75);padding: .75rem 1.6rem;"><strong class="weui-dialog__title" style="color: #fff;">任务调整</strong></div>
					<div class="weui-dialog__bd" style="background-color: #fff;">
						<div style="height: 1.5rem;"></div>
						<!-- <div style="text-align: left;padding-bottom: .75rem;">您的需求已提交,待接件人员办理后，会以短信方式通知您</div> -->
						<div class="ul clearfix">
							<div class="li" v-for="(item,index) in adjust" @click="adjustClick(item.value)" :class="[item.value==adjustIndex?'active':'']">
								<!-- <img src="image/checkNO.png" alt=""><img src="image/checkOK.png" class="ok" alt=""> -->
								{{item.title}}
							</div>
						</div>

						<div class="textarea" v-if="date">
							<div class="label">{{taskDate}}</div>
							<input type="text" id="taskTime" readonly />
						</div>
						<div class="textarea" v-if="cause">
							<div class="label">{{taskCause}}</div>
							<textarea placeholder="" v-model="description" style="height: 4rem;"></textarea>
						</div>
						<div style="height: .5rem;"></div>
					</div>
					<div class="weui-dialog__ft">
						<div @click="tipBoole = false" class="weui-dialog__btn weui-dialog__btn_default" style="background-color: #ededed;color: #676767;">取消</div>
						<div @click="submit" class="weui-dialog__btn weui-dialog__btn_primary" style="background-color: #0787d5;color: #fff;">确定</div>
					</div>
				</div>
			</div>
			<!-- loading加载 -->
			<div style="opacity: 1;" v-if="loading">
				<div class="weui-mask_transparent"></div>
				<div class="weui-toast">
					<img src="image/load.gif" alt="" style="width: 2rem;margin: 2rem auto .5rem;">
					<p class="weui-toast__content">加载中</p>
				</div>
			</div>
			<!-- 统计数量 -->
			<div class="statisticsBtn" @click="statisClick">
				<img src="image/tongji.png" alt="" />
			</div>
			<!-- 统计数量弹出层 -->
			<div class="statisticsTip" v-if="statistics">
				<div class="statisticsView">
					<div class="statistics clearfix">
						<div class="list" @click="taskAll" style="width: 100%;">
							<img src="image/xmzs.png" alt="" class="icon">
							<div class="text">调整记录</div>
							<div class="num">{{statisticsInfo.haveAdjustedNum}}/{{statisticsInfo.adjustNum}} <span style="font-size: .7rem;">条</span></div>
						</div>
						<div class="list" @click="evalAll">
							<img src="image/pjzs.png" alt="" class="icon">
							<div class="text">评价记录</div>
							<div class="num">{{statisticsInfo.evaluationNum}} <span style="font-size: .7rem;">条</span></div>
						</div>
						<div class="list" @click="compAll">
							<img src="image/tszs.png" alt="" class="icon">
							<div class="text">投诉记录</div>
							<div class="num">{{statisticsInfo.haveComplaintNum}}/{{statisticsInfo.complaintNum}} <span style="font-size: .7rem;">条</span></div>
						</div>
						<img src="image/closeW.png" alt="" class="statisticsClose" @click="statisticsClose">
					</div>
				</div>
			</div>
		</div>
		<script src="script/jquery-3.5.js"></script>
		<script src="script/vue.js"></script>
		<script src="script/api.js"></script>
		<script src="script/ajax.js"></script>
		<script src="script/laydate/laydate.js"></script>
		<script>
			var app = new Vue({
				el: '#containerVue',
				data: {
					param: {
						keyWord: '',
						pageNo: 1,
						pageSize: 10
					}, // 搜索条件
					info: [], // 首页列表
					tipBoole: false,
					isEnd: false,
					isAjax: false,
					loading: false,
					adjust: [], // 任务调整列表
					adjustIndex: "",
					proId: "",
					description: "",
					roleCode: "", // 角色类型
					scanInfo: null, // 扫描信息
					statistics: false, // 统计层
					statisticsInfo: {}, // 统计信息

					time: "", // 提交调整日期
					taskDate: "", // 调整日期
					taskCause: "", // 调整原因
					date: false, // 调整日期显示
					cause: false, // 调整原因显示
				},
				created() {
					this.getStatistics();
					this.getList(true);
				},
				watch: {},
				methods: {
					// 显示统计弹出层
					statisClick() {
						this.statistics = true;
						this.getStatistics();
					},
					// 任务调整总数查看
					taskAll() {
						window.location.href = 'taskAllList.html';
					},
					// 评价总数查看
					compAll() {
						window.location.href = 'complaintAllList.html';
					},
					// 评价总数查看
					evalAll() {
						window.location.href = 'evalAllList.html';
					},
					// 关闭统计层
					statisticsClose() {
						this.statistics = false;
					},
					// 获取统计信息
					getStatistics() {
						var that = this;
						ajaxHttp({
							url: 'jeecg-boot/node/nodeContract/getAllTotalInfos',
							type: 'post',
							data: {},
							success: function(res) {
								if (res.code == '200') {
									// console.log(JSON.stringify(res));
									that.statisticsInfo = res.result
								} else {
									$.Jwarning(res.message)
								}
							}
						});
					},
					// 列表详情页
					listDetail(item) {
						window.location.href = "index_detail.html";
						sessionStorage.setItem('indexInfo', JSON.stringify(item));
					},
					// 任务调整弹出层
					taskClick(e) {
						this.getNearestOne(e.id);
						this.tipBoole = true;
						this.proId = e.id;
						this.time = "";
						this.adjustIndex = "";
						this.description = "";
						this.date = false;
						this.cause = false;
					},
					// 判断最近一次任务调整状态
					getNearestOne(proid) {
						var that = this;
						ajaxHttp({
							url: 'jeecg-boot/node/nodeProjectAdjustment/getNearestOneByProId',
							type: 'post',
							data: {proId: proid},
							success: function(res) {
								if (res.code == '200') {
									console.log(JSON.stringify(res.result));
									if (res.result) {
										if (res.result.type == '3') {
											that.getDutyChange(res.result.type)
										} else {
											that.getDutyChange()
										}
									} else {
										that.getDutyChange()
									}
								} else {
									$.Jwarning(res.message)
								}
							}
						});
					},
					// 获取任务调整状态
					getDutyChange(types) {
						var that = this;
						ajaxHttp({
							url: 'jeecg-boot/sys/dict/getDictItems/DutyChange',
							type: 'get',
							data: {},
							success: function(res) {
								if (res.success) {
									if (types == '3') {
										res.result.splice(2, 1);
									} else {
										res.result.splice(3, 1);
									}
									that.adjust = res.result
								} else {
									$.Jwarning(res.message)
								}
							}
						});
					},
					// 任务调整状态更改
					adjustClick(i) {
						this.adjustIndex = i;
						if (i == 1) {
							this.date = false;
							this.time = "";
							this.cause = true;
							this.taskCause = "任务变更描述";
						} else if (i == 2) {
							this.date = false;
							this.time = "";
							this.cause = true;
							this.taskCause = "任务取消描述";
						} else if (i == 3) {
							this.date = false;
							this.time = "";
							this.cause = true;
							this.taskCause = "任务暂停描述";
						} else {
							this.date = true;
							this.taskDate = "任务重启时间";
							this.cause = false;
							this.description = "";
							setTimeout(function() {
								laydate.render({
									elem: "#taskTime", //指定元素
									type: 'date',
									trigger: 'click',
									showBottom: false,
									theme: '#0787d5',
									done: function(value, date, endDate) {
										app.time = value;
									}
								});
							}, 5 * 100);
						}
					},
					// 投诉页面跳转
					compUrl(item) {
						window.location.href = "complaint.html";
						sessionStorage.setItem('compInfo', JSON.stringify(item));
					},
					// 评价页面跳转
					evalUrl(item) {
						window.location.href = "evaluate.html";
						sessionStorage.setItem('evalInfo', JSON.stringify(item));
					},
					// 清楚搜索条件
					clearSearch() {
						this.param.keyWord = "";
					},
					// 手机端search回调
					searchName(e) {
						this.param.pageNo = 1;
						this.isEnd = false;
						this.getList(true);
					},
					// 判断是否走登录页面
					getLogin() {
						let userName = $.Request('userName');
						let that = this;
						if (userName == 'null') {
							this.getList(true)
						} else {
							loginHttp({
								url: 'jeecg-boot/sys/ssologin',
								type: 'post',
								data: {
									'userName': userName
								},
								success: function(res) {
									// 本地存入token
									if (res.success) {
										localStorage.setItem('access_token', res.result['token']);
										that.getList(true);
									} else {
										$.Jwarning(res.message)
									}
								}
							})
						}
					},
					// 获取首页列表
					getList(selet_type) {
						let that = this;
						if ($.Request('userName') == 'null') {
							// 获取首页列表(外部)
							if (that.isEnd || that.isAjax) {
								return;
							}
							that.isAjax = true;
							ajaxHttp({
								url: 'jeecg-boot/node/nodeContract/queryPageListByPhone',
								type: 'post',
								data: that.param,
								beforeSend: function() {
									that.loading = true
								},
								success: function(res) {
									console.log(JSON.stringify(res));
									that.isAjax = false;
									if (res.success) {
										if (selet_type) {
											that.info = res.result.records;
										} else {
											that.info = that.info.concat(res.result.records);
										}
										that.isEnd = res.result.pages == that.param.pageNo;
										++that.param.pageNo;
									} else {
										$.Jwarning(res.message)
									}
								},
								complete: function() {
									that.loading = false
								}
							})
						} else {

						}

					},
					// 提交任务状态
					submit() {
						let that = this;
						if (that.adjustIndex == "") {
							$.Jwarning('请选择任务状态')
						} else {
							if (that.adjustIndex == 1) {
								if (that.description == '') {
									return $.Jwarning('请填写变更内容')
								}
								ajaxHttp({
									url: 'jeecg-boot/node/nodeProjectInfo/editOperateStatusByProId',
									type: 'post',
									data: {
										"operateStatus": that.adjustIndex,
										"proId": that.proId,
										"description": that.description,
										"time": that.time
									},
									success: function(res) {
										// console.log(JSON.stringify(res));
										if (res.success) {
											$.Jsuccess('提交成功')
											setTimeout(function() {
												that.tipBoole = false;
												that.param.pageNo = 1;
												that.isEnd = false;
												that.getList(true);
											}, 3000)
										} else {
											$.Jwarning(res.message)
										}
									}
								})
							} else if (that.adjustIndex == 2) {
								if (that.description == '') {
									return $.Jwarning('请填写取消原因')
								}
								ajaxHttp({
									url: 'jeecg-boot/node/nodeProjectInfo/editOperateStatusByProId',
									type: 'post',
									data: {
										"operateStatus": that.adjustIndex,
										"proId": that.proId,
										"description": that.description,
										"time": that.time
									},
									success: function(res) {
										// console.log(JSON.stringify(res));
										if (res.success) {
											$.Jsuccess('提交成功')
											setTimeout(function() {
												that.tipBoole = false;
												that.param.pageNo = 1;
												that.isEnd = false;
												that.getList(true);
											}, 3000)
										} else {
											$.Jwarning(res.message)
										}
									}
								})
							} else if (that.adjustIndex == 3) {
								if (that.description == '') {
									return $.Jwarning('请填写暂停原因')
								}
								ajaxHttp({
									url: 'jeecg-boot/node/nodeProjectInfo/editOperateStatusByProId',
									type: 'post',
									data: {
										"operateStatus": that.adjustIndex,
										"proId": that.proId,
										"description": that.description,
										"time": that.time
									},
									success: function(res) {
										// console.log(JSON.stringify(res));
										if (res.success) {
											$.Jsuccess('提交成功')
											setTimeout(function() {
												that.tipBoole = false;
												that.param.pageNo = 1;
												that.isEnd = false;
												that.getList(true);
											}, 3000)
										} else {
											$.Jwarning(res.message)
										}
									}
								})
							} else {
								if(that.time == '') {
									return $.Jwarning('请选择任务重启时间')
								}
								ajaxHttp({
									url: 'jeecg-boot/node/nodeProjectInfo/editOperateStatusByProId',
									type: 'post',
									data: {
										"operateStatus": that.adjustIndex,
										"proId": that.proId,
										"description": that.description,
										"time": that.time
									},
									success: function(res) {
										// console.log(JSON.stringify(res));
										if (res.success) {
											$.Jsuccess('提交成功')
											setTimeout(function() {
												that.tipBoole = false;
												that.param.pageNo = 1;
												that.isEnd = false;
												that.getList(true);
											}, 3000)
										} else {
											$.Jwarning(res.message)
										}
									}
								})
							}
						}
					}
				},
			})
			// 上拉触底事件
			var screenHeight = window.screen.height;
			window.onscroll = function() {
				if (screenHeight + document.body.scrollTop >= document.body.scrollHeight - 50) {
					app.getList(false)
				}
			}
		</script>
	</body>
</html>
